home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / toms_tra.swf / scripts / frame_5 / DoAction.as
Text File  |  2010-04-12  |  2KB  |  108 lines

  1. function navigate(lab)
  2. {
  3.    gotoAndStop(lab);
  4. }
  5. getURL("FSCommand:showmenu",false);
  6. getURL("FSCommand:allowscale",false);
  7. navigate("loading");
  8. MovieClip.prototype.makeSound = function(snd, vol, loops, effect)
  9. {
  10.    if(this.playing_sound == null)
  11.    {
  12.       this.playing_sound = new Sound();
  13.       this.playing_sound.attachSound(snd);
  14.       var thesound = this.playing_sound;
  15.       this.playing_sound.onSoundComplete = function()
  16.       {
  17.          delete thesound;
  18.       };
  19.    }
  20.    if(effect == null)
  21.    {
  22.       this.playing_sound.setVolume(vol);
  23.       this.playing_sound.start(0,loops);
  24.    }
  25.    else
  26.    {
  27.       if(effect == "stop")
  28.       {
  29.          var thesound = this.playing_sound;
  30.          thesound.stop();
  31.          delete thesound;
  32.       }
  33.       if(effect == "fadein")
  34.       {
  35.       }
  36.       if(effect == "fadeout")
  37.       {
  38.       }
  39.    }
  40. };
  41. MovieClip.prototype.setToColor = function(col)
  42. {
  43.    if(col == "none")
  44.    {
  45.       col = {ra:100,ga:100,ba:100,rb:0,gb:0,bb:0,aa:100,ab:0};
  46.    }
  47.    this.curCol = new Color(this);
  48.    this.curCol.setTransform(col);
  49. };
  50. MovieClip.prototype.getCordsDepth = function(r, c)
  51. {
  52.    var _loc1_ = 0;
  53.    i = 0;
  54.    while(i <= r)
  55.    {
  56.       _loc1_ += i;
  57.       i++;
  58.    }
  59.    if(c != 0)
  60.    {
  61.       var _loc2_ = r + 2;
  62.       i = 1;
  63.       while(i <= c)
  64.       {
  65.          _loc1_ += _loc2_;
  66.          _loc2_ = _loc2_ + 1;
  67.          i++;
  68.       }
  69.    }
  70.    return _loc1_;
  71. };
  72. MovieClip.prototype.convertCords = function(cords)
  73. {
  74.    var _loc2_ = 21;
  75.    var _loc3_ = 61.9;
  76.    if(cords.col != null)
  77.    {
  78.       var _loc4_ = new Object();
  79.       _loc4_.x = cords.row * (_loc3_ / -2) + cords.col * (_loc3_ / 2);
  80.       _loc4_.y = cords.row * (_loc2_ / 2) + cords.col * (_loc2_ / 2);
  81.       return _loc4_;
  82.    }
  83.    var _loc5_ = new Object();
  84.    _loc5_.row = (cords.y / (_loc2_ / -2) + cords.x / (_loc3_ / 2)) / -2;
  85.    _loc5_.col = (cords.x / (_loc3_ / 2) + cords.y / (_loc2_ / 2)) / 2;
  86.    return _loc5_;
  87. };
  88. MovieClip.prototype.fadeTo = function(alph, spd)
  89. {
  90.    if(alph == 0)
  91.    {
  92.       spd = 2;
  93.    }
  94.    else
  95.    {
  96.       spd = 7;
  97.    }
  98.    this.onEnterFrame = function()
  99.    {
  100.       this._alpha += (alph - this._alpha) / spd;
  101.       if(Math.abs(alph - this._alpha) < 2)
  102.       {
  103.          this._alpha = alph;
  104.          this.onEnterFrame = null;
  105.       }
  106.    };
  107. };
  108.